package com.lds.register.center.server.business.appinstance.converter;

import com.lds.register.center.common.model.appinstance.response.AppInstanceBaseResponse;
import com.lds.register.center.server.business.appinstance.entity.AppInstance;
import org.springframework.core.convert.converter.Converter;
import org.springframework.stereotype.Component;


@Component
public class AppInstanceToBaseResponseConverter implements Converter<AppInstance, AppInstanceBaseResponse> {

    @Override
    public AppInstanceBaseResponse convert(AppInstance source) {
        return AppInstanceBaseResponse.builder()
                .id(source.getId())
                .creator(source.getCreator())
                .modifier(source.getModifier())
                .createTime(source.getCreateTime())
                .updateTime(source.getUpdateTime())
                .ip(source.getIp())
                .port(source.getPort())
                .healthy(source.getHealthy())
                .appId(source.getAppId())
                .weight(source.getWeight())
                .enabled(source.getEnabled())
                .build();
    }

}


